import { createRouter, createWebHistory } from "vue-router";
import HomeNav from "../views/HomeNav.vue";
import HomeRecommend from "../views/HomeRecommend.vue";
import HomeSaloon from "../views/HomeSaloon.vue";
import HomeMine from "../views/HomeMine.vue";
import HomeShi from "../views/HomeShi.vue";
import HomeXiao from "../views/HomeXiao.vue";
import DetailView from "../views/DetailView.vue";
import HotView from "../views/HotView.vue";
// import xiaoshipin from "../gongneng/xiaoshipin.vue";


const routes = [{
    path: '/caseinfoeditor/:caseId',
    name: "caseinfoeditor",
    component: () =>
        import ('@/views/caseinfoeditor.vue')
}];

const router = createRouter({
    history: createWebHistory(
        import.meta.env.BASE_URL),
    routes: [{
            path: "/",
            name: "home",
            component: HomeNav,
            children: [{
                    path: "",
                    name: "recommend",
                    component: HomeRecommend,
                    children: [{
                            path: "",
                            name: "hot",
                            component: HotView,
                        },
                        {
                            path: "ying",
                            name: "ying",
                            component: () =>
                                import ('../views/YingView.vue')
                        },
                        {
                            path: "dai",
                            name: "dai",
                            component: () =>
                                import ('../views/DaiView.vue')
                        },
                        {
                            path: "sutra",
                            name: "sutra",
                            component: () =>
                                import ('../views/SutraView.vue')
                        },
                    ]
                },
                {
                    path: '/mine',
                    name: 'mine',
                    component: HomeMine,
                    // beforeEnter: (to, from, next) => {
                    //     let token = window.localStorage.getItem("token");
                    //     if (!token) {
                    //         next("/loginin");
                    //         return;
                    //     } else {
                    //         next();
                    //     }
                    // },
                    // meta: { showBar: true },
                },
                {
                    path: "shi",
                    name: "shi",
                    component: HomeShi,
                },
                {
                    path: "xiao",
                    name: "xiao",
                    component: HomeXiao,
                    children: [{
                            path: "/xiao",
                            name: "/tuijian",
                            component: () =>
                                import ('../views/TuiJian.vue')
                        },
                        {
                            path: "/repian",
                            name: "/repian",
                            component: () =>
                                import ('../views/RePian.vue')
                        },
                        {
                            path: "/xinpian",
                            name: "/xinpian",
                            component: () =>
                                import ('../views/XinPian.vue')
                        },
                        {
                            path: "/sukan",
                            name: "/sukan",
                            component: () =>
                                import ('../views/SuKan.vue')
                        },
                        {
                            path: "/juji",
                            name: "/juji",
                            component: () =>
                                import ('../views/JuJi.vue')
                        },
                    ]
                },

            ],
        },
        {
            path: "/saloon",
            name: "/saloon",
            component: HomeSaloon,
        },
        {
            path: "/detail",
            name: "detail",
            component: DetailView,
        },
        {
            path: '/caseinfoeditor',
            name: "caseinfoeditor",
            component: () =>
                import ('@/views/caseinfoeditor.vue')
        },
        {
            path: '/position',
            name: "position",
            component: () =>
                import ('@/gongneng/PosiTion.vue')
        },
        {
            path: '/xiaoshipin',
            name: "xiaoshipin",
            component: () =>
                import ('@/gongneng/xiaoshipin.vue')
        },
        {
            path: '/playvideo',
            name: "playvideo",
            component: () =>
                import ('@/gongneng/PlayVideo.vue')
        },
        {
            path: '/purchase',
            name: "purchase",
            component: () =>
                import ('@/gongneng/PurcHase.vue')
        },
        {
            path: '/xuanzuo',
            name: "xuanzuo",
            component: () =>
                import ('@/gongneng/XuanZuo.vue')
        },
        {
            path: '/Cindetails',
            name: "Cindetails",
            component: () =>
                import ('@/components/Cindetails.vue')
        },
        {
            path: '/zuowei',
            name: "zuowei",
            component: () =>
                import ('@/xuanzuowei/ZuoWei.vue')
        },
        {
            path: '/loginin',
            name: "loginin",
            component: () =>
                import ('@/gongneng/denglu/loginin.vue')
        },
        {
            path: '/search',
            name: "search",
            component: () =>
                import ('@/gongneng/search/search.vue')
        },
        {
            path: '/dingdan',
            name: "dingdan",
            component: () =>
                import ('@/gongneng/dingdan.vue')
        },
        // {
        //     path: '/Register',
        //     name: "Register",
        //     component: () =>
        //         import ('@/gongneng/Register.vue')
        // },
        // {
        //     path: '/login',
        //     name: "login",
        //     component: () =>
        //         import ('@/gongneng/Login.vue')
        // },


        // {
        //   path: '/about',
        //   name: 'about',
        //   // route level code-splitting
        //   // this generates a separate chunk (About.[hash].js) for this route
        //   // which is lazy-loaded when the route is visited.
        //   component: () => import('../views/AboutView.vue')
        // }
    ],
})

export default router